package com.lagou;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;

/**
 * @author Kirito
 * @description:
 * @date 2020/05/03
 */
public class Test {

    public static void main(String[] args) throws DocumentException, FileNotFoundException {

        File file = new File("G:\\code\\webapps\\web_demo1\\WEB-INF\\web.xml");
        Document document = new SAXReader().read(file);
        Element rootElement = document.getRootElement();
        Element servlet = rootElement.element("servlet");

        List list = document.getRootElement().selectNodes("//servlet");

        System.out.println(list);
    }
}
